filter() works a bit like dropWhile(), except that it applies the lambda check to all elements. Only those for which the lambda evaluates to true will be passed along.

Here, the lambda is looking for numbers divisible by 3, so only 3, 6, and 9 will be printed.

You can learn more about this in:
Tags:
Run Edit